
import 'dart:convert';

import 'package:flutter_test/flutter_test.dart';
import 'package:im_app/im/socket/dto/business/Login.dart';

void main() {
  test("test json", (){
    LoginReq loginReq = new LoginReq(userId: "test00100", password: "123456", machineCode: "asfafa",
        tenantCode: '0000', terminalType: 'android');
    Map<String, dynamic> jsonMap = loginReq.toJson();
    print(jsonMap.toString());
    LoginReq newLoginReq = LoginReq.fromJson(jsonMap);
    Map<String, dynamic> jsonMap2 = newLoginReq.toJson();
    print(jsonMap2);
    expect(jsonMap, jsonMap2);
    // expect(loginReq, newLoginReq);
  });

  test("test array", (){
    List<int> list = [1, 2, 3, 4];
    List<Object> params = [];
    params.addAll(list);
    params.add("dfafa");
    String json = jsonEncode(params);
    print('json: $json');
  });

  test("test set", (){
    Set<String> set = Set<String>();
    set.add("zhugeliang");
    set.add("刘备");
    var isContain = set.contains('zhugeliang');
    print('json: $isContain');
  });

}